package com.example.baimao_tp.viewmodel

import android.content.ContentValues
import android.content.Context
import android.content.SharedPreferences
import android.os.Build
import android.os.Environment
import android.provider.MediaStore
import android.util.Log
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.baimao_tp.data.ReferenceImage
import com.example.baimao_tp.data.PoseConfigManager
import com.example.baimao_tp.data.mockReferenceImages
import com.example.baimao_tp.data.model.PoseItem
import com.example.baimao_tp.data.repository.ReferenceImageRepository
import androidx.camera.core.ImageCapture
import androidx.camera.core.ImageCaptureException
import androidx.core.content.ContextCompat
import kotlinx.coroutines.launch
import java.io.File
import java.io.FileOutputStream
import java.io.OutputStream
import java.net.URLEncoder
import java.nio.charset.StandardCharsets
import java.text.SimpleDateFormat
import java.util.*

class CameraViewModel : ViewModel() {
    private val TAG = "CameraViewModel"
    private val repository = ReferenceImageRepository()

    // 姿势配置
    private val _availablePoses = mutableStateOf<List<PoseItem>>(emptyList())
    val availablePoses: List<PoseItem> get() = _availablePoses.value

    // 引导界面相关状态
    private val _showGuide = mutableStateOf(false)
    val showGuide: Boolean get() = _showGuide.value

    private val _currentGuideStep = mutableIntStateOf(0)
    val currentGuideStep: Int get() = _currentGuideStep.intValue

    // SharedPreferences key for guide completion
    private val PREFS_NAME = "guide_prefs"
    private val GUIDE_COMPLETED_KEY = "guide_completed"

    init {
        Log.d(TAG, "CameraViewModel初始化完成")
        Log.d(TAG, "初始模拟数据数量: ${mockReferenceImages.size}")
    }

    /**
     * 加载姿势配置
     */
    fun loadPoseConfig(context: Context) {
        viewModelScope.launch {
            try {
                val result = PoseConfigManager.getPosesForLanguage(context, selectedLanguage)
                result.onSuccess { poses ->
                    _availablePoses.value = poses
                    Log.d(TAG, "姿势配置加载成功，姿势数量: ${poses.size}")
                }.onFailure { error ->
                    Log.e(TAG, "姿势配置加载失败: ${error.message}", error)
                }
            } catch (e: Exception) {
                Log.e(TAG, "加载姿势配置时发生异常", e)
            }
        }
    }

    private val _currentImageIndex = mutableIntStateOf(0)
    val currentImageIndex: Int get() = _currentImageIndex.intValue

    private val _referenceImages = mutableStateOf(mockReferenceImages)
    val referenceImages: List<ReferenceImage> get() = _referenceImages.value

    private val _isLoading = mutableStateOf(false)
    val isLoading: Boolean get() = _isLoading.value

    private val _errorMessage = mutableStateOf<String?>(null)
    val errorMessage: String? get() = _errorMessage.value

    private val _isFlashOn = mutableStateOf(false)
    val isFlashOn: Boolean get() = _isFlashOn.value

    // Language setting
    private val _selectedLanguage = mutableStateOf("en")
    val selectedLanguage: String get() = _selectedLanguage.value

    
    // Pose selection settings
    private val _selectedLocation = mutableStateOf("Outdoor")
    val selectedLocation: String get() = _selectedLocation.value

    private val _selectedModel = mutableStateOf("Male")
    val selectedModel: String get() = _selectedModel.value

    private val _selectedStyle = mutableStateOf<String>("")
    val selectedStyle: String get() = _selectedStyle.value

    private val _isImageExpanded = mutableStateOf(false)
    val isImageExpanded: Boolean get() = _isImageExpanded.value

    private val _capturedImages = mutableStateOf<List<String>>(emptyList())
    val capturedImages: List<String> get() = _capturedImages.value

    private val _showCapturedImages = mutableStateOf(false)
    val showCapturedImages: Boolean get() = _showCapturedImages.value

    // ImageCapture实例，用于拍照
    var imageCapture: ImageCapture? = null

    // 标记是否已经应用了筛选条件，避免无条件请求覆盖有条件请求
    private val _hasFiltersApplied = mutableStateOf(false)
    val hasFiltersApplied: Boolean get() = _hasFiltersApplied.value

    // 重置筛选条件标记（用于完全重新开始）
    fun resetFilters() {
        _hasFiltersApplied.value = false
        Log.d(TAG, "已重置筛选条件标记，可以进行无条件加载")
    }

    val currentReferenceImage: ReferenceImage?
        get() = referenceImages.getOrNull(currentImageIndex)

    fun nextImage() {
        if (currentImageIndex < referenceImages.size - 1) {
            _currentImageIndex.intValue++
        }
    }

    fun previousImage() {
        if (currentImageIndex > 0) {
            _currentImageIndex.intValue--
        }
    }

    fun canGoNext(): Boolean = currentImageIndex < referenceImages.size - 1

    fun canGoPrevious(): Boolean = currentImageIndex > 0

    fun toggleFlash() {
        _isFlashOn.value = !_isFlashOn.value
    }

    fun setLanguage(language: String, context: Context? = null) {
        val oldLanguage = _selectedLanguage.value
        _selectedLanguage.value = language
        Log.d(TAG, "语言切换: $oldLanguage -> $language")

        // 如果语言发生改变，重新获取数据以更新描述
        if (oldLanguage != language) {
            Log.d(TAG, "语言已改变，重置筛选条件并重新获取参考图片数据...")
            resetFilters() // 重置筛选条件，允许无条件加载
            fetchReferenceImagesFromServer()

            // 重新加载姿势配置
            context?.let { ctx ->
                loadPoseConfig(ctx)
            }
        }
    }

    fun setLocation(location: String) {
        _selectedLocation.value = location
    }

    fun setModel(model: String) {
        _selectedModel.value = model
    }

    fun setStyle(styleValue: String) {
        _selectedStyle.value = styleValue
        Log.d(TAG, "姿势设置: $styleValue")
    }


    // Fetch reference images from server
    fun fetchReferenceImagesFromServer() {
        // 如果已经应用了筛选条件，不再执行无条件请求以避免覆盖
        if (_hasFiltersApplied.value) {
            Log.d(TAG, "已应用筛选条件，跳过无条件请求以避免覆盖筛选结果")
            return
        }

        Log.d(TAG, "开始从服务器获取参考图片，当前语言: ${_selectedLanguage.value}...")
        viewModelScope.launch {
            Log.d(TAG, "设置加载状态为true")
            _isLoading.value = true
            _errorMessage.value = null

            try {
                Log.d(TAG, "调用Repository获取数据，语言参数: ${_selectedLanguage.value}")
                val result = repository.getReferenceImages(_selectedLanguage.value)

                result.onSuccess { images ->
                    Log.d(TAG, "服务器数据获取成功，图片数量: ${images.size}")
                    _referenceImages.value = images
                    _currentImageIndex.intValue = 0 // 重置索引
                    Log.d(TAG, "数据更新完成，当前索引: ${_currentImageIndex.intValue}")

                    // 打印当前图片信息
                    currentReferenceImage?.let { currentImage ->
                        Log.d(TAG, "当前参考图片: id=${currentImage.id}, imageUrl=${currentImage.imageUrl}, description=${currentImage.description}")
                    }
                }.onFailure { error ->
                    Log.e(TAG, "获取参考图片失败: ${error.message}", error)
                    _errorMessage.value = "获取参考图片失败: ${error.message}"
                }
            } catch (e: Exception) {
                Log.e(TAG, "网络请求异常: ${e.message}", e)
                _errorMessage.value = "网络请求异常: ${e.message}"
            } finally {
                Log.d(TAG, "设置加载状态为false")
                _isLoading.value = false
            }
        }
    }

    // 图片展开状态控制
    fun toggleImageExpanded() {
        _isImageExpanded.value = !_isImageExpanded.value
    }

    fun closeImageExpanded() {
        _isImageExpanded.value = false
    }

    // 拍照功能
    fun capturePhoto(context: Context, onPhotoSaved: (String?) -> Unit) {
        val imageCapture = imageCapture ?: run {
            Log.e(TAG, "ImageCapture未初始化")
            onPhotoSaved(null)
            return
        }

        val timestamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date())
        val imageFileName = "Baimao_${timestamp}.jpg"

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            // Android 10+ 使用 MediaStore API
            val contentValues = ContentValues().apply {
                put(MediaStore.MediaColumns.DISPLAY_NAME, imageFileName)
                put(MediaStore.MediaColumns.MIME_TYPE, "image/jpeg")
                put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_PICTURES + "/BaimaoTP")
            }

            val outputOptions = ImageCapture.OutputFileOptions.Builder(
                context.contentResolver,
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                contentValues
            ).build()

            imageCapture.takePicture(
                outputOptions,
                ContextCompat.getMainExecutor(context),
                object : ImageCapture.OnImageSavedCallback {
                    override fun onImageSaved(output: ImageCapture.OutputFileResults) {
                        val savedUri = output.savedUri?.toString()
                        Log.d(TAG, "拍照成功: $savedUri")

                        savedUri?.let { uri ->
                            val updatedList = _capturedImages.value.toMutableList()
                            updatedList.add(0, uri) // 添加到列表开头
                            _capturedImages.value = updatedList
                            Log.d(TAG, "当前拍摄图片总数: ${_capturedImages.value.size}")
                        }

                        onPhotoSaved(savedUri)
                    }

                    override fun onError(exception: ImageCaptureException) {
                        Log.e(TAG, "拍照失败: ${exception.message}", exception)
                        onPhotoSaved(null)
                    }
                }
            )
        } else {
            // Android 9及以下使用传统文件方式
            val storageDir = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "BaimaoTP")
            if (!storageDir.exists()) {
                storageDir.mkdirs()
            }

            val imageFile = File(storageDir, imageFileName)
            val outputOptions = ImageCapture.OutputFileOptions.Builder(imageFile).build()

            imageCapture.takePicture(
                outputOptions,
                ContextCompat.getMainExecutor(context),
                object : ImageCapture.OnImageSavedCallback {
                    override fun onImageSaved(output: ImageCapture.OutputFileResults) {
                        val savedPath = imageFile.absolutePath
                        Log.d(TAG, "拍照成功: $savedPath")

                        val updatedList = _capturedImages.value.toMutableList()
                        updatedList.add(0, savedPath) // 添加到列表开头
                        _capturedImages.value = updatedList
                        Log.d(TAG, "当前拍摄图片总数: ${_capturedImages.value.size}")

                        onPhotoSaved(savedPath)
                    }

                    override fun onError(exception: ImageCaptureException) {
                        Log.e(TAG, "拍照失败: ${exception.message}", exception)
                        onPhotoSaved(null)
                    }
                }
            )
        }
    }

    // 显示/隐藏拍摄图片
    fun toggleCapturedImages() {
        _showCapturedImages.value = !_showCapturedImages.value
        if (_showCapturedImages.value) {
            _isImageExpanded.value = false // 确保关闭参考图片展示
        }
    }

    fun closeCapturedImages() {
        _showCapturedImages.value = false
    }

    // 清除错误消息
    fun clearErrorMessage() {
        _errorMessage.value = null
    }

    // 构建tags参数用于API请求
    private fun buildTagsParam(): String {
        val locationMap = mapOf(
            "Outdoor" to "户外",
            "Indoor" to "室内"
        )

        val modelMap = mapOf(
            "Male" to "男性",
            "Female" to "女性"
        )

        val tags = mutableListOf<String>()

        // 添加地点标签
        locationMap[_selectedLocation.value]?.let { tags.add(it) }

        // 添加模特标签
        modelMap[_selectedModel.value]?.let { tags.add(it) }

        // 添加姿势标签 - 直接使用value（单选）
        if (_selectedStyle.value.isNotEmpty()) {
            tags.add(_selectedStyle.value)  // 直接使用配置文件中的value
        }

        val result = tags.joinToString(separator = ",")
        Log.d(TAG, "构建的tags参数: $result")
        Log.d(TAG, "  地点: ${locationMap[_selectedLocation.value]}")
        Log.d(TAG, "  模特: ${modelMap[_selectedModel.value]}")
        Log.d(TAG, "  姿势value: ${_selectedStyle.value}")
        // Retrofit会自动处理@Query参数的URL编码，不需要手动编码
        return result
    }

    // 生成姿势功能
    fun generatePoses(onComplete: () -> Unit = {}) {
        Log.d(TAG, "开始生成姿势，当前选择:")
        Log.d(TAG, "  地点: ${_selectedLocation.value}")
        Log.d(TAG, "  模特: ${_selectedModel.value}")
        Log.d(TAG, "  姿势: ${_selectedStyle.value}")

        // 标记已应用筛选条件
        _hasFiltersApplied.value = true
        Log.d(TAG, "已标记应用筛选条件，后续无条件请求将被阻止")

        // 使用tags参数重新获取参考图片，在加载完成后执行回调
        fetchReferenceImagesWithTags {
            onComplete()
        }
    }

    // 使用tags参数获取参考图片
    private fun fetchReferenceImagesWithTags(onComplete: () -> Unit = {}) {
        val tags = buildTagsParam()
        Log.d(TAG, "使用tags参数获取参考图片: $tags")

        // 总是使用tags API，即使是默认选择也需要传递给服务器进行过滤
        viewModelScope.launch {
            _isLoading.value = true
            _errorMessage.value = null

            try {
                Log.d(TAG, "即将调用Repository.getReferenceImagesWithTags，语言=${_selectedLanguage.value}, tags=$tags")
                val result = repository.getReferenceImagesWithTags(_selectedLanguage.value, tags)

                result.onSuccess { images ->
                    Log.d(TAG, "带tags的参考图片获取成功，图片数量: ${images.size}")
                    _referenceImages.value = images
                    _currentImageIndex.intValue = 0

                    currentReferenceImage?.let { currentImage ->
                        Log.d(TAG, "当前参考图片: id=${currentImage.id}, imageUrl=${currentImage.imageUrl}, description=${currentImage.description}")
                    }
                }.onFailure { error ->
                    Log.e(TAG, "带tags的参考图片获取失败: ${error.message}", error)
                    _errorMessage.value = "获取参考图片失败: ${error.message}"
                }
            } catch (e: Exception) {
                Log.e(TAG, "带tags的网络请求异常: ${e.message}", e)
                _errorMessage.value = "网络请求异常: ${e.message}"
            } finally {
                _isLoading.value = false
                // 在数据加载完成后执行回调
                onComplete()
            }
        }
    }

    // 引导界面相关方法

    /**
     * 检查是否需要显示引导界面
     */
    fun checkAndShowGuide(context: Context) {
        val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
        val guideCompleted = prefs.getBoolean(GUIDE_COMPLETED_KEY, false)

        if (!guideCompleted) {
            Log.d(TAG, "首次使用，显示引导界面")

            // 强制根据系统默认语言设置引导语言
            val systemLanguage = getSystemLanguage(context)
            Log.d(TAG, "系统默认语言: $systemLanguage")
            Log.d(TAG, "当前ViewModel语言设置: ${_selectedLanguage.value}")

            // 强制设置为系统语言（不管当前是什么）
            _selectedLanguage.value = systemLanguage
            Log.d(TAG, "引导界面语言强制设置为: ${_selectedLanguage.value}")

            // 延迟显示引导界面，确保语言设置生效
            viewModelScope.launch {
                kotlinx.coroutines.delay(100)
                _showGuide.value = true
                _currentGuideStep.intValue = 0
                Log.d(TAG, "引导界面已显示，语言: ${_selectedLanguage.value}")
            }
        } else {
            Log.d(TAG, "引导已完成，跳过引导")
            _showGuide.value = false
        }
    }

    /**
     * 获取系统默认语言
     */
    private fun getSystemLanguage(context: Context): String {
        Log.d(TAG, "=== 开始检测系统语言 ===")
        Log.d(TAG, "SDK版本: ${android.os.Build.VERSION.SDK_INT}")

        // 方法1：通过Context获取
        val locale1 = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
            context.resources.configuration.locales[0]
        } else {
            @Suppress("DEPRECATION")
            context.resources.configuration.locale
        }
        Log.d(TAG, "方法1 - Context获取的语言: ${locale1.language}, 国家: ${locale1.country}, 显示名: ${locale1.displayName}")

        // 方法2：通过Locale.getDefault()获取
        val locale2 = Locale.getDefault()
        Log.d(TAG, "方法2 - Locale.getDefault(): ${locale2.language}, 国家: ${locale2.country}, 显示名: ${locale2.displayName}")

        // 方法3：通过Resources获取当前配置
        val config = context.resources.configuration
        val locale3 = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
            config.locales[0]
        } else {
            @Suppress("DEPRECATION")
            config.locale
        }
        Log.d(TAG, "方法3 - Resources配置: ${locale3.language}, 国家: ${locale3.country}, 显示名: ${locale3.displayName}")

        // 方法4：检查应用上下文的语言
        val appLocale = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
            context.applicationContext.resources.configuration.locales[0]
        } else {
            @Suppress("DEPRECATION")
            context.applicationContext.resources.configuration.locale
        }
        Log.d(TAG, "方法4 - ApplicationContext: ${appLocale.language}, 国家: ${appLocale.country}, 显示名: ${appLocale.displayName}")

        // 方法5：通过ActivityManager获取系统语言（可能更准确）
        try {
            val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as android.app.ActivityManager
            val runningTasks = activityManager.getRunningTasks(1)
            if (runningTasks.isNotEmpty()) {
                val topActivity = runningTasks[0].topActivity
                Log.d(TAG, "方法5 - 当前Activity: $topActivity")
            }
        } catch (e: Exception) {
            Log.w(TAG, "无法获取Activity信息: ${e.message}")
        }

        // 智能选择最可靠的语言检测结果
        var selectedLocale: java.util.Locale
        var detectionMethod = ""

        // 优先级1：ApplicationContext（通常能获取到正确的系统语言）
        if (appLocale.language.startsWith("zh") || appLocale.language.startsWith("en")) {
            selectedLocale = appLocale
            detectionMethod = "ApplicationContext"
        }
        // 优先级2：Context获取的配置
        else if (locale1.language.startsWith("zh") || locale1.language.startsWith("en")) {
            selectedLocale = locale1
            detectionMethod = "Context"
        }
        // 优先级3：系统默认Locale
        else if (locale2.language.startsWith("zh") || locale2.language.startsWith("en")) {
            selectedLocale = locale2
            detectionMethod = "Locale.getDefault"
        }
        // 兜底：使用Resources配置
        else {
            selectedLocale = locale3
            detectionMethod = "Resources配置"
        }

        Log.d(TAG, "选择使用${detectionMethod}的语言检测结果: ${selectedLocale.language}-${selectedLocale.country}")
        val languageCode = selectedLocale.language

        Log.d(TAG, "最终选择的语言代码: $languageCode")
        Log.d(TAG, "最终选择的国家代码: ${selectedLocale.country}")
        Log.d(TAG, "最终语言的显示名: ${selectedLocale.displayName}")

        val resultLanguage = when {
            languageCode.startsWith("zh") -> "zh"  // 中文
            languageCode.startsWith("en") -> "en"  // 英文
            else -> "en"  // 默认英文
        }

        Log.d(TAG, "映射后的应用语言代码: $resultLanguage")
        Log.d(TAG, "=== 系统语言检测完成 ===")

        return resultLanguage
    }

    /**
     * 进入下一步引导
     */
    fun nextGuideStep() {
        if (_currentGuideStep.intValue < 2) { // 总共3步，索引0-2
            _currentGuideStep.intValue++
            Log.d(TAG, "引导步骤: ${_currentGuideStep.intValue}")
        }
    }

    /**
     * 跳过引导
     */
    fun skipGuide(context: Context) {
        completeGuide(context)
    }

    /**
     * 完成引导
     */
    fun completeGuide(context: Context) {
        Log.d(TAG, "引导完成")
        _showGuide.value = false
        _currentGuideStep.intValue = 0

        // 保存引导完成状态
        val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
        prefs.edit()
            .putBoolean(GUIDE_COMPLETED_KEY, true)
            .apply()
    }

    /**
     * 重置引导状态（用于测试）
     */
    fun resetGuide(context: Context) {
        Log.d(TAG, "重置引导状态")
        val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
        prefs.edit()
            .putBoolean(GUIDE_COMPLETED_KEY, false)
            .apply()

        // 重置时也根据系统语言重新设置
        val systemLanguage = getSystemLanguage(context)
        _selectedLanguage.value = systemLanguage

        _showGuide.value = false
        _currentGuideStep.intValue = 0

        Log.d(TAG, "引导状态已重置，语言设置为: $systemLanguage")
    }

    /**
     * 强制显示引导界面（用于测试）
     */
    fun forceShowGuide() {
        Log.d(TAG, "强制显示引导界面")
        _showGuide.value = true
        _currentGuideStep.intValue = 0
    }

    /**
     * 测试系统语言检测（用于调试）
     */
    fun testSystemLanguageDetection(context: Context) {
        Log.d(TAG, "=== 完整的系统语言检测测试 ===")

        // 检查当前所有可能的语言设置
        val currentLocale = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
            context.resources.configuration.locales[0]
        } else {
            @Suppress("DEPRECATION")
            context.resources.configuration.locale
        }

        Log.d(TAG, "1. 当前Context Locale: ${currentLocale.language}-${currentLocale.country}")
        Log.d(TAG, "2. 当前ViewModel语言: ${_selectedLanguage.value}")
        Log.d(TAG, "3. 系统默认Locale: ${Locale.getDefault().language}-${Locale.getDefault().country}")
        Log.d(TAG, "4. 应用Resources Locale: ${context.resources.configuration.locales[0].language}")

        // 检查字符串资源
        try {
            val testString = context.getString(com.example.baimao_tp.R.string.guide_title_1)
            Log.d(TAG, "5. 获取到的字符串资源: $testString")
        } catch (e: Exception) {
            Log.e(TAG, "获取字符串资源失败: ${e.message}")
        }

        // 检查当前Resources的语言配置
        val resources = context.resources
        val config = resources.configuration
        Log.d(TAG, "6. Resources配置语言: ${config.locales[0].language}")
        Log.d(TAG, "7. Resources配置国家: ${config.locales[0].country}")

        // 检查显示设置
        val displayMetrics = resources.displayMetrics
        Log.d(TAG, "8. 屏幕密度: ${displayMetrics.density}")

        Log.d(TAG, "=======================")
    }

    /**
     * 获取当前引导步骤的标题资源ID
     */
    fun getCurrentGuideTitleResource(): Int {
        return when (_currentGuideStep.intValue) {
            0 -> com.example.baimao_tp.R.string.guide_title_1
            1 -> com.example.baimao_tp.R.string.guide_title_2
            2 -> com.example.baimao_tp.R.string.guide_title_3
            else -> com.example.baimao_tp.R.string.guide_title_1
        }
    }

    /**
     * 获取当前引导步骤的描述资源ID
     */
    fun getCurrentGuideDescriptionResource(): Int {
        return when (_currentGuideStep.intValue) {
            0 -> com.example.baimao_tp.R.string.guide_desc_1
            1 -> com.example.baimao_tp.R.string.guide_desc_2
            2 -> com.example.baimao_tp.R.string.guide_desc_3
            else -> com.example.baimao_tp.R.string.guide_desc_1
        }
    }

    /**
     * 获取当前引导步骤的目标高亮区域
     */
    fun getCurrentGuideHighlightArea(): GuideHighlightArea {
        return when (_currentGuideStep.intValue) {
            0 -> GuideHighlightArea.REFERENCE_THUMBNAIL
            1 -> GuideHighlightArea.EXPANDED_IMAGE
            2 -> GuideHighlightArea.SETTINGS_BUTTON
            else -> GuideHighlightArea.REFERENCE_THUMBNAIL
        }
    }
}

/**
 * 引导高亮区域枚举
 */
enum class GuideHighlightArea {
    REFERENCE_THUMBNAIL,    // 参考图片缩略图区域
    EXPANDED_IMAGE,         // 放大的图片区域
    SETTINGS_BUTTON         // 设置按钮区域
}
